﻿#ifndef INSTRUCTIONTHERMOSTATTEMPERATURERATE
#define INSTRUCTIONTHERMOSTATTEMPERATURERATE

#include "ScriptInstruction.h"

class InstructionThermostatTemperatureRate :public ScriptInstruction
{
	Q_OBJECT
private:
	ScriptRunner* scriptRunner = Q_NULLPTR;
	TurnTableCodec* turnTableCodec = Q_NULLPTR;
	float temperatureRate = 0;
public:
	InstructionThermostatTemperatureRate(float temperatureRate)
	{
		scriptRunner = ScriptInstruction::getScriptRunner();
		turnTableCodec = ScriptInstruction::getTurnTableCodec();
		this->temperatureRate = temperatureRate;
		instructionFlag = Instruction_Thermostat_TemperatureRate;
	}
	~InstructionThermostatTemperatureRate()
	{}
public:
	void run()override
	{
		turnTableCodec->sendInstruction(TurnTableCodec::Thermostat_TemperatureRate,temperatureRate,0,0);
		scriptRunner->scriptWaitAndRun(scriptRunner->getInterval_instruction());
	}
	QVector<float> getDataForSaving()override
	{
		QVector<float> savingData;
		savingData.append(instructionFlag);
		savingData.append(temperatureRate);
		return savingData;
	}
};
#endif
